home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 1992 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.0 KB

  1. Path: shrike.depaul.edu!usenet
  2. From: Kazuki Murakami <kmurakam@shrike.depaul.edu>
  3. Newsgroups: comp.lang.c
  4. Subject: question on pass-by-reference
  5. Date: 16 Jan 1996 22:50:59 GMT
  6. Organization: DePaul University
  7. Message-ID: <4dha4j$4qg@shrike.depaul.edu>
  8. NNTP-Posting-Host: dept11.ac-sia.depaul.edu
  9.  
  10.  
  11. I have a question on pass-by-reference.
  12. Here is a problem, I want to set array of unsigned short number to be all 0 using a function.
  13. here is what set looks like:
  14.     typedef unsigned short USHORT;
  15.     typedef  USHORT SET[32];
  16.  
  17. here is the setInit, which will initialize set to be 0,
  18.     void setInit (SET *s)
  19.     {
  20.         int i;
  21.  
  22.         for (i=0; i<32; i++)
  23.         {
  24.             *s[i] = 0;
  25.         }
  26.     }
  27.  
  28. here is the calling function.
  29.         setInit(&set1);  setInit(&set2);
  30.  
  31. I think there is somthing wrong in "setInit" function but I cannot seem to figure out what that is.
  32. If somebody can figure out what that is or some other way of initializing "SET s" please give
  33. me a e-mail.
  34. e-mail address is kmurakam@shrike.edpaul.edu
  35.  
  36. Thank you
  37.         
  38. Kazuki Murakami
  39.